package com.qiu.greened.network

import com.google.gson.annotations.SerializedName

data class BaseResponse<T>(
    @SerializedName("code")
    val code: Int, // 200
    @SerializedName("msg")
    val msg: String, // 登录成功
    @SerializedName("data")
    val `data`: T,
    ){
    fun dataConvert(): T {
        if (code == 200) {
            return data
        } else {
            throw Exception(msg)
        }
    }
}